package com.wlstock.funi.model;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.json.JSONObject;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * 操盘手历史统计表
 * @author admin
 *
 */
@DatabaseTable(tableName = "FundStaticModel")
public class FundStaticModel extends BaseModel{
//    "FundId": 1,
//    "FundName": "波段1号",
//    "SumProfitPreCent": 0.3655,//这一期总的
//    "TradeCount": 8
	
//    "SellAvgPrice": 16.85,
//    "EndDate": "10-1409:45",
//    "FundName": "波段1号",
//    "ProfitPreCent": 0.06,
//    "StartDate": "10-1209:32",
//    "StockName": "辉隆股份",
//    "FundId": 1,
//    "StockNo": "002556",
//    "SumProfitPreCent": 0.06,//截至当前的
//    "TradeCount": 1, //一只
//    "BuyAvgPrice": 15.85
//	Seanson:""
	@DatabaseField (generatedId = true)
	private int id;
	@DatabaseField
	private int FundId;
	@DatabaseField
	private String FundName;
	@DatabaseField
	private double SumProfitPreCent;
	@DatabaseField
	private int TradeCount;
	@DatabaseField
	private float SellAvgPrice;
	@DatabaseField
	private Date EndDate;
	@DatabaseField
	private float ProfitPreCent;
	@DatabaseField
	private Date StartDate;
	@DatabaseField
	private String StockName;
	@DatabaseField
	private String StockNo;
	@DatabaseField
	private float PreTradeSumProfitPreCent;//之前交易的所有收益
	@DatabaseField
	private int OneTradeCount;
	@DatabaseField
	private float BuyAvgPrice;
	@DatabaseField
	private int Season;
	
	public  FundStaticModel() {}
	
	public int getFundId() {
		return FundId;
	}
	public void setFundId(int fundId) {
		FundId = fundId;
	}
	public String getFundName() {
		return FundName;
	}
	public void setFundName(String fundName) {
		FundName = fundName;
	}
	public double getSumProfitPreCent() {
		return SumProfitPreCent;
	}
	public void setSumProfitPreCent(double sumProfitPreCent) {
		SumProfitPreCent = sumProfitPreCent;
	}
	public int getTradeCount() {
		return TradeCount;
	}
	public void setTradeCount(int tradeCount) {
		TradeCount = tradeCount;
	}
	public float getSellAvgPrice() {
		return SellAvgPrice;
	}
	public void setSellAvgPrice(float sellAvgPrice) {
		SellAvgPrice = sellAvgPrice;
	}
	public Date getEndDate() {
		return EndDate;
	}
	public void setEndDate(Date endDate) {
		EndDate = endDate;
	}
	public float getProfitPreCent() {
		return ProfitPreCent;
	}
	public void setProfitPreCent(float profitPreCent) {
		ProfitPreCent = profitPreCent;
	}
	public Date getStartDate() {
		return StartDate;
	}
	public void setStartDate(Date startDate) {
		StartDate = startDate;
	}
	public String getStockName() {
		return StockName;
	}
	public void setStockName(String stockName) {
		StockName = stockName;
	}
	public String getStockNo() {
		return StockNo;
	}
	public float getPreTradeSumProfitPreCent() {
		return PreTradeSumProfitPreCent;
	}
	public void setPreTradeSumProfitPreCent(float preTradeSumProfitPreCent) {
		PreTradeSumProfitPreCent = preTradeSumProfitPreCent;
	}
	public void setStockNo(String stockNo) {
		StockNo = stockNo;
	}

	public int getOneTradeCount() {
		return OneTradeCount;
	}
	public void setOneTradeCount(int oneTradeCount) {
		OneTradeCount = oneTradeCount;
	}
	public float getBuyAvgPrice() {
		return BuyAvgPrice;
	}
	public void setBuyAvgPrice(float buyAvgPrice) {
		BuyAvgPrice = buyAvgPrice;
	}
	public int getSeason() {
		return Season;
	}
	public void setSeason(int season) {
		Season = season;
	}
	
	public void setOneTradeInfo(JSONObject object) throws ParseException{
//	    "SellAvgPrice": 16.85,
//	    "EndDate": "10-1409:45",
//	    "FundName": "波段1号",//
//	    "ProfitPreCent": 0.06,
//	    "StartDate": "10-1209:32",
//	    "StockName": "辉隆股份",
//	    "FundId": 1,//
//	    "StockNo": "002556",
//	    "SumProfitPreCent": 0.06,//一只
//	    "TradeCount": 1, //一只
//	    "BuyAvgPrice": 15.85
		SimpleDateFormat sdf ;
		      
		sdf = new SimpleDateFormat("yyyy-MM-ddHH:mm");
		this.setSellAvgPrice((float) object.optDouble("SellAvgPrice"));
		this.setEndDate(sdf.parse(object.optString("EndDate")));
		this.setProfitPreCent((float)object.optDouble("ProfitPreCent"));
		this.setStartDate(sdf.parse(object.optString("StartDate")));
		this.setStockName(object.optString("StockName"));
		this.setStockNo(object.optString("StockNo"));
		this.setPreTradeSumProfitPreCent((float)object.optDouble("SumProfitPreCent"));
		this.setTradeCount(object.optInt("TradeCount"));
		this.setBuyAvgPrice((float) (object.optDouble("BuyAvgPrice")));
			
		sdf = null;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	
}
